package wxk.interview.hash.map;

/**
 * @author wangxuekai
 * @version 2.2
 * @Date 2017/3/22.
 * @since 2.2
 */
public class MyHashKey {
    private Integer integer;

    public MyHashKey(Integer integer) {
        this.integer = integer;
    }

    public Integer getInteger() {
        return integer;
    }

    public void setInteger(Integer integer) {
        this.integer = integer;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MyHashKey myHashKey = (MyHashKey) o;

        return integer != null ? integer.equals(myHashKey.integer) : myHashKey.integer == null;
    }

    @Override
    public int hashCode() {
        return integer != null ? integer.hashCode() : 0;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("MyHashKey{");
        sb.append("integer=").append(integer);
        sb.append('}');
        return sb.toString();
    }
}
